﻿package frEngine.core.lenses
{
    import __AS3__.vec.*;

    public class OrthographicLens extends LensBase
    {
        private var _projectionHeight:Number;
        private var _xMax:Number;
        private var _yMax:Number;
        private var _scaleX:Number = 1;
        private var _scaleY:Number = 1;
        private static const RAW_DATA_CONTAINER:Vector.<Number> = OrthographicLens.Vector.<Number>([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);

        public function OrthographicLens(param1:Number = 500)
        {
            this._projectionHeight = param1;
            return;
        }// end function

        public function get projectionHeight() : Number
        {
            return this._projectionHeight;
        }// end function

        public function set projectionHeight(param1:Number) : void
        {
            if (param1 == this._projectionHeight)
            {
                return;
            }
            this._projectionHeight = param1;
            invalidateMatrix();
            return;
        }// end function

        public function setScale(param1:Number, param2:Number) : void
        {
            this._scaleX = param1;
            this._scaleY = param2;
            invalidateMatrix();
            return;
        }// end function

        override public function clone() : LensBase
        {
            var _loc_1:* = new OrthographicLens();
            _loc_1._near = _near;
            _loc_1._far = _far;
            _loc_1._aspectRatio = _aspectRatio;
            _loc_1.projectionHeight = this._projectionHeight;
            return _loc_1;
        }// end function

        override protected function updateMatrix() : void
        {
            var _loc_1:* = RAW_DATA_CONTAINER;
            _loc_1[0] = 2 / (this._projectionHeight * _aspectRatio) * this._scaleX;
            _loc_1[5] = 2 / this._projectionHeight * this._scaleY;
            _loc_1[10] = 1 / (_far - _near);
            _loc_1[14] = _near / (_near - _far);
            _matrix.copyRawDataFrom(_loc_1);
            _matrixInvalid = false;
            return;
        }// end function

    }
}
